import fetcher from '@/service/fetcher';

// GET
const api = {
  getList: (params) => {
    return fetcher.get('/api/demo/list', { params });
  },
  create: (data) => {
    return fetcher.post('/demo/create', data);
  },
  upload: (data) => {
    return fetcher.post('/upload', data);
  },
  detail: (params) => {
    return fetcher.get('/demo/detail', { params });
  },
  update: (data) => {
    return fetcher.put('/demo/update', data);
  },
  delete: (params) => {
    return fetcher.delete('/demo/delete', { params });
  },
 
  head: (params) => {
    return fetcher.head('/demo/head', { params });
  },
  options: (params) => {
    return fetcher.options('/demo/options', { params });
  },
   
  get: (params) => {
    return fetcher.get('/demo/get', { params });
  },
  post: (data) => {
    return fetcher.post('/demo/post', data);
  },
  put: (data) => {
    return fetcher.put('/demo/put', data);
  },
  delete: (params) => {
    return fetcher.delete('/demo/delete', { params });
  },
  head: (params) => {
    return fetcher.head('/demo/head', { params });
  },
 
 
}
 
export default api;
// const fd = new FormData();
// fd.append('file', file);
// fetcher.post('/upload', fd, { headers: { /* 可自定义 */ } });

// 完整配置
// fetcher({
//   url: '/demo/detail',
//   method: 'GET',
//   params: { id: 1 },
//   headers: { 'X-Custom': '1' },
//   timeout: 10000,
//   baseURL: '/api',
// });